package com.yunji.common.exception;


import com.yunji.common.constants.ResultCodeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * @author Deom
 * 研学旅行自定义异常类
 */
@Data
@ApiModel(value = "全局异常")
public class Baby_P2PException extends RuntimeException {
    @ApiModelProperty(value = "状态码")
    private Integer code;

    /**
     *      
     * * 接受状态码和消息      
     * * @param code      
     * * @param message      
     */
    public Baby_P2PException(Integer code, String message) {
        super(message);
        this.code=code;
    }

    /**
     *      
     * * 接受状态码和消息      
     * * @param code      
     * * @param message      
     */
    public Baby_P2PException(ResultCodeEnum resultCodeEnum){
        super(resultCodeEnum.getMessage());
        this.code=resultCodeEnum.getCode();
    }

    @Override
    public String toString(){
        return "Baby_P2PException{"+"message="+ this.getMessage()+", code="+code+'}';
    }
}
